# -*- coding: utf-8 -*-
# File : results.py
# Author: taoyahui
# Date : 2021/10/17
import json
from utils import datetime_utils

empty_result = json.dumps({'code': 404001, 'data': '存在数据为空'}, ensure_ascii=False)
exists_result = json.dumps({'code': 201001, 'data': '数据已存在'}, ensure_ascii=False)

success_result = json.dumps({'code': 200, 'data': 'ok'}, ensure_ascii=False)

user_password_error = json.dumps(
    {'code': 202, 'data': '密码错误'}, ensure_ascii=False
)

not_login_result = json.dumps(
    {'code': 500001, 'data': '用户未登录'}, ensure_ascii=False
)


def gen_result(code, data):
    return json.dumps({'code': code, 'data': data}, ensure_ascii=False, cls=datetime_utils.ComplexEncoder, sort_keys=True)
